import request from '@/utils/request';
import { AxiosResponse } from 'axios';

// 定义通用API响应接口
export interface ApiResponse<T> {
  code: number;
  msg: string;
  data: T;
}

// 定义登录成功时data字段的接口
export interface LoginData {
  Token: string;
  UserInfo: {
    F_Account: string;
    F_HeadIcon: string;
    F_Mobile: string;
    F_RealName: string;
    F_UserId: string;
  };
}

export function login(data: any): Promise<ApiResponse<LoginData>> {
  return request.post<ApiResponse<LoginData>>('/zc/login', data).then((response: AxiosResponse<ApiResponse<LoginData>>) => {
    return response.data; // 提取 response.data 作为实际的 ApiResponse
  });
} 